Skip to content

Use esp_timer_get_time as time source for micros and mills #1424

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 22, 2018

Conversation

igrr
Copy link
Member

@igrr igrr commented May 22, 2018

esp_timer_get_time returns monotonic time in microseconds, as a 64-bit number. It can be called from tasks and interrupts, does not use any critical sections/mutexes, and is thread safe. Calls to it can be made while cache is disabled. Since IDF commit espressif/esp-idf@0d65f3b, the time returned by esp_timer is also updated after light sleep: it appears to the application as if the timer was running during light sleep.

@me-no-dev
Copy link
Member

Awesome! How long does it take to call esp_timer_get_time? Also please remove this line: https://github.com/espressif/arduino-esp32/blob/master/cores/esp32/main.cpp#L17

Copy link
Member

@me-no-dev me-no-dev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! How long does it take to call esp_timer_get_time? It must not take more than a microsecond or two or it will make delayMicroseconds() inaccurate

Also please remove this line: https://github.com/espressif/arduino-esp32/blob/master/cores/esp32/main.cpp#L17

esp_timer_get_time returns monotonic time in microseconds, as a 64-bit
number. It can be called from tasks and interrupts, does not use any
critical sections/mutexes, and is thread safe.
@igrr igrr force-pushed the micros_from_esp_timer branch from 370fd63 to fcb19c2 Compare May 22, 2018 13:32
@igrr
Copy link
Member Author

igrr commented May 22, 2018

@me-no-dev
Copy link
Member

Awesome! Just need Travis to get done building :)

@me-no-dev me-no-dev merged commit 93c45af into master May 22, 2018
@me-no-dev me-no-dev deleted the micros_from_esp_timer branch May 22, 2018 14:12
Curclamas pushed a commit to Curclamas/arduino-esp32 that referenced this pull request Aug 21, 2018
…#1424)

esp_timer_get_time returns monotonic time in microseconds, as a 64-bit
number. It can be called from tasks and interrupts, does not use any
critical sections/mutexes, and is thread safe.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants